package ch7.ex16;

import static ch7.print.Print.*;

public class Starship {
	public static void main(String... args){
		StartShip eprise = new StartShip();
		println(eprise);
		eprise.setStatus(new YellowAlertStatus());
		println(eprise);
		eprise.setStatus(new RedAlertStatus());
		println(eprise);
	}

}

class AlertStatus{
	public String getStatus(){
		return "None";
	}
}

class RedAlertStatus extends AlertStatus{
	public String getStatus(){
		return "Red";
	}
}

class YellowAlertStatus extends AlertStatus{
	public String getStatus(){
		return "Yellow";
	}
}

class GreenAlertStatus extends AlertStatus{
	public String getStatus(){
		return "Green";
	}
}

class StartShip{
	private AlertStatus status = new GreenAlertStatus();
	public void setStatus(AlertStatus istatus){
		status = istatus;
	}
	public String toString(){
		return status.getStatus();
	}
}